package com.ruoyi.process.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.process.domain.PestControl;
import com.ruoyi.process.mapper.PestControlMapper;
import com.ruoyi.process.service.IPestControlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 有害生物日管控Service业务层处理
 *
 * @author wng
 * @date 2024-08-04
 */
@Service
public class PestControlServiceImpl implements IPestControlService {
    @Resource
    private PestControlMapper pestControlMapper;

    /**
     * 查询有害生物日管控
     *
     * @param id 有害生物日管控主键
     * @return 有害生物日管控
     */
    @Override
    public PestControl selectPestControlById(Long id) {
        return pestControlMapper.selectPestControlById(id);
    }

    /**
     * 查询有害生物日管控列表
     *
     * @param pestControl 有害生物日管控
     * @return 有害生物日管控
     */
    @Override
    public List<PestControl> selectPestControlList(PestControl pestControl) {
        return pestControlMapper.selectPestControlList(pestControl);
    }

    /**
     * 新增有害生物日管控
     *
     * @param pestControl 有害生物日管控
     * @return 结果
     */
    @Override
    public int insertPestControl(PestControl pestControl) {
        pestControl.setCreateTime(DateUtils.getNowDate());
        return pestControlMapper.insertPestControl(pestControl);
    }

    /**
     * 修改有害生物日管控
     *
     * @param pestControl 有害生物日管控
     * @return 结果
     */
    @Override
    public int updatePestControl(PestControl pestControl) {
        pestControl.setUpdateTime(DateUtils.getNowDate());
        return pestControlMapper.updatePestControl(pestControl);
    }

    /**
     * 批量删除有害生物日管控
     *
     * @param ids 需要删除的有害生物日管控主键
     * @return 结果
     */
    @Override
    public int deletePestControlByIds(Long[] ids) {
        return pestControlMapper.deletePestControlByIds(ids);
    }

    /**
     * 删除有害生物日管控信息
     *
     * @param id 有害生物日管控主键
     * @return 结果
     */
    @Override
    public int deletePestControlById(Long id) {
        return pestControlMapper.deletePestControlById(id);
    }
}
